﻿$(document).ready(
    function () {
        var cur = 0;
        var items = $('#popular li');
        var max = items.length - 1;
        var prev = max - 1;

        items.first().slideDown();
        setInterval(flipTile, 5000);

        function flipTile() {
            var prev = items.eq(cur);
            if (++cur > max)
                cur = 0;
            var next = items.eq(cur);
            prev.slideUp(function () {
                next.slideDown();
            })
        }
    }
);